using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace MechaShark
{
    class Projectile
    {
        //-------------Members-------------
        public Model Model;
        public Matrix currentWorld;
        public Matrix currentView;
        public Matrix currentProj;
        public float cameraDistance = 70;
        public float speed = 0;

        public float Arc = 90;
        public float Rotation = 90;
        public float Distance = 100;

        public float xpos;
        public float ypos;

        //-------------Methods-------------
        //constructor
        public Projectile(Model model, float x, float y, float Speed)
        {
            speed = Speed;
            Model = model;
            xpos = x;
            ypos = y;
            //shotAngle = (float)(Math.Atan2(mouse.Y - ypos, mouse.X - xpos) * 180 / Math.PI);
        }
        public void moveProjectile(GraphicsDevice Device, GameTime gameTime)
        {
            float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            xpos -= speed * time * 0.10f;// *(float)Math.Cos(shotAngle); //adjust in the future for diagonal shots?
            //ypos += speed * time * 0.10f;// *(float)Math.Sin(shotAngle);

            currentWorld = Matrix.CreateRotationY(MathHelper.ToRadians(270)) *
            Matrix.CreateRotationX(MathHelper.ToRadians(0)) *
            Matrix.CreateRotationZ(MathHelper.ToRadians(0)) *
            Matrix.CreateTranslation(xpos, ypos, 0);

            currentView = Matrix.CreateRotationY(MathHelper.ToRadians(0)) *
            Matrix.CreateRotationX(MathHelper.ToRadians(0)) *
            Matrix.CreateTranslation(0, 0, -cameraDistance);

            currentProj = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi / 4,
                                                                    Device.Viewport.AspectRatio,
                                                                    1,
                                                                    1000);
        }
    }
}
